package cn.hp.crm.util;

import java.util.List;

//  分页工具类
public class PageBean {
    private int currentPage ; // 当前页数
    private int totalNumber ; // 总条数
    private int dataVolumePerPage ; // 每页数据数
    private int totalPages ; // 总页数
    private List<?> data ; // 每页数据

    public int getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }

    public int getTotalNumber() {
        return totalNumber;
    }

    public void setTotalNumber(int totalNumber) {
        this.totalNumber = totalNumber;
    }

    public int getTotalPages() {
        return totalPages;
    }

    public void setTotalPages() {
//        总条数/每页显示数 = 总页数
//        28  10   2 +1
//        20  10   2
        if (totalNumber%dataVolumePerPage == 0) {
            totalPages = totalNumber/dataVolumePerPage;
        }else {
            totalPages = totalNumber/dataVolumePerPage + 1;
        }
    }

    public int getDataVolumePerPage() {
        return dataVolumePerPage;
    }

    public void setDataVolumePerPage(int dataVolumePerPage) {
        this.dataVolumePerPage = dataVolumePerPage;
    }

    public List<?> getData() {
        return data;
    }

    public void setData(List<?> data) {
        this.data = data;
    }
}
